//封装ajax

var ajax = {
    myUrl : "http://192.168.192.100:8080/BaorOASys/",
    post:function(url,json,callback){
        var xhr = new XMLHttpRequest();
        //创建请求
        xhr.open("post",url);
        //创建请求头
        xhr.setRequestHeader("Content-type","application/json");
        //发送请求
        xhr.send(JSON.stringify(json));
        //监听请求
        xhr.onreadystatechange = function(){
            console.log(xhr.readyState)
            console.log(xhr.status);
            if(xhr.readyState == 4 && xhr.status == 200){
                var res = JSON.parse(xhr.responseText);
                callback(res);
            }
        }
    }
}